<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <link rel="shortcut icon" href="../../image/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../../css/main.css" media="all">
</head>
<body>
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 测试测试   -->
            <div class="layui-col-xs1 layui-col-sm1 layui-col-md1">&nbsp;</div>
            <!-- 头部区域 -->
            <div class="layui-col-xs4 layui-col-sm6 layui-col-md6">
                <div style="display:inline-block;margin-left: 20px;">
                    <img id="logimage" src="../../image/logo.png" height="50px" style="padding-top: 5px;cursor:pointer"
                         title="首页"
                         onclick="window.open('index.html', '_top', '', 'true')">
                </div>
            </div>

            <div class="layui-col-xs6 layui-col-sm4 layui-col-md4">
                <ul class="layui-nav" align="right" lay-filter="layadmin-layout-right">
                    <li class="layui-nav-item" lay-unselect>
                        <a id="icon-btn" href="javascript:;">
                            <img id="stuimg" src="../../image/avatar.png" class="layui-nav-img">
                            <cite id="stuname">贤心</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd id="viewinfo"><a>基本资料</a></dd>
                            <dd id="changepwd"><a>修改密码</a></dd>
                            <hr>
                            <dd id="logout" style="text-align: center;"><a>退出</a></dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                        <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                </ul>
            </div>
            <div class="layui-col-xs1 layui-col-sm1 layui-col-md1">&nbsp;</div>
        </div>
    </div>
</div>

<!--内容主题-->
<div style="padding: 20px; background-color: #F2F2F2;">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1">&nbsp;</div>
        <!-- 主题内容-->
        <div class="layui-col-xs10 layui-col-sm10 layui-col-md10">
            <!--            搜索框-->
            <div class="layui-card">
                <div class="layui-card-body" style="padding: 10px;">
                    <div class="layui-form layui-form-pane">
                        <div class="layui-form-item" style="margin-bottom: 10px">
                            <div class="layui-col-xs1 layui-col-sm1 layui-col-md1" style="margin-left: 10px">
                                <select name="qt">
                                    <option value="company">公司</option>
                                    <option value="position" selected="selected">职位</option>
                                </select>
                            </div>
                            <div class="layui-col-md10 layui-inline" style="margin-right: 0px">
                                <input type="text" name="kw" placeholder="请输入查询的内容" autocomplete="off"
                                       class="layui-input">
                            </div>
                            <button class="layui-btn" id="searchbtn">
                                <i class="layui-icon layui-icon-search"
                                   style="padding-left: 10px;padding-right: 10px"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <!--职位推荐-->
            <div class="layui-card" style="margin-top: 50px">
                <div class="layui-card-body" style="overflow:auto;padding: 20px;margin-top: 30px">
                    <h3 style="text-align:center;">——职位推荐——</h3>
                    <div class="layui-tab layui-tab-card" style="margin-top: 20px;">
                        <ul class="layui-tab-title" style="background-color: white">
                            <li class="layui-this">推荐职位</li>
                            <li>最新职位</li>
                        </ul>
                        <div class="layui-tab-content layui-bg-gray">
                            <div class="layui-tab-item layui-show">
                                <div class="layui-fluid" id="LAY-component-grid-list">
                                    <div class="layui-row layui-col-space12 demo-list" id="recommendjob">
                                        <!--    推荐岗位       -->
                                    </div>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <div class="layui-fluid" id="LAY-component-grid-list1">
                                    <div class="layui-row layui-col-space12 demo-list" id="latestPosition">
                                        <!--   最新岗位  -->
                                    </div>
                                </div>
                            </div>
                        </div>
                        <button id="seeMore"
                                class="layui-btn layui-btn-primary layui-col-md2 layui-bg-green layui-col-md-offset5"
                                style="text-align: center;margin-top: 30px;">查看更多
                        </button>
                    </div>
                </div>
            </div>

            <!--热门企业-->
            <div class="layui-card">
                <div class="layui-card-body"
                     style="overflow:auto;padding: 20px;margin-top: 30px">
                    <h3 style="text-align:center;">——热门企业——</h3>
                    <div class="layui-tab layui-tab-card" style="margin-top: 20px;">
                        <ul class="layui-tab-title" style="background-color: white">
                            <li class="layui-this">最新企业</li>
                            <li>明星企业</li>
                        </ul>
                        <div class="layui-tab-content layui-bg-gray">
                            <div class="layui-tab-item layui-show">
                                <div class="layui-fluid layui-bg-gray" id="LAY-component-grid-list3">
                                    <div class="layui-row layui-col-space12 demo-list" id="latestEnterprise"></div>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <div class="layui-fluid" id="LAY-component-grid-list4">
                                    <div class="layui-row layui-col-space12 demo-list" id="famousEnterprise"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<div class="layui-col-xs2 layui-col-sm2 layui-col-md2">&nbsp;</div>
<!-- 企业推荐模板 -->
<script id="demotpl1" type="text/html">
    {{#  layui.each(d.list, function(index, item){ }}
    <div class="layui-col-sm4 layui-col-md3 layui-col-lg3">
        <!-- 填充内容 -->
        <div class="layui-card" style="padding: 30px">
            <div align="center">
                <img src="{{item.logoimg ||'../image/alibaba.jpg'}}"
                     style="height: 30px;width: 30px;border:1px solid #00F7DE;border-radius:10px;">
            </div>
            <div style="text-align: center;margin-top: 5px;">
                <a href="viewenterpriseinfo.html?eid={{item.enterpriseid}}"
                   style="color:#FF5722;font-size: 16px;font-weight: bolder">
                    {{ item.enterprisename }}
                </a>
            </div>
            <div style="text-align: center;font-size: 10px;margin-top: 5px;">
                <p class="layui-inline">{{ item.authInfomation.enterprisetype }}</p>
            </div>
        </div>
    </div>
    {{#  }); }}
    {{#  if(d.list.length === 0){ }}
    无数据
    {{#  } }}
</script>
<!-- 岗位推荐模板 -->
<script id="demotpl" type="text/html">
    {{#  layui.each(d.list, function(index,item){ }}
    <div class="layui-col-sm6 layui-col-md8 layui-col-lg4">
        <!-- 填充内容 -->
        <div class="layui-card" style="padding: 1px">
            <div class="layui-inline">
                <a href="jobDetail.html?jobid={{item.jobid}}"
                   style="color: #01AAED;margin-left: 5px;font-size: 17px;">
                    {{ item.jobname }}
                </a>
            </div>
            <i class="layui-icon layui-icon-star"></i>
            <div class="layui-inline"
                 style="color:#ff5722;float: right;margin-right: 15px;font-size: 18px">{{ item.jobsalary }}
            </div>
            <div style="margin-left: 5px">
                <p class="layui-inline">{{ item.needpeople }}人</p>
                <p class="layui-inline">|</p>
                <p class="layui-inline">{{ item.educationrequirements||''}}</p>
            </div>
            <hr>
            <i class="layui-icon layui-icon-engine layui-inline" style="margin-left: 5px"></i>
            <p class="layui-inline" style="margin-left: 5px">
                <a href="viewenterpriseinfo.html?eid={{item.enterprise.enterpriseid}}">
                    {{ item.enterprise.enterprisename }}
                </a>
            </p>
            <div class="layui-inline" style="float: right;margin-right: 10px;">{{ item.workplace }}</div>
            <i class="layui-icon layui-icon-location layui-inline" style="float: right;margin-right: 10px;"></i>
        </div>
    </div>
    {{#  }); }}

    {{#  if(d.list.length === 0){ }}
    无数据
    {{#  } }}
</script>
<script src="../../libs/layui/layui.js"></script>
<script src="../../js/header.js"></script>
<script>
    layui.use(['laytpl', 'jquery', 'element', 'form', "layarea", "layer", "carousel", "okUtils", "okLayer"], function () {
        let element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        let layer = layui.layer;
        let carousel = layui.carousel;
        let $ = layui.jquery;
        let laytpl = layui.laytpl;
        let okUtils = layui.okUtils;
        let okLayer = layui.okLayer;
        // 获取contentText
        const ctx = function () {
            let pathName = document.location.pathname;
            let index = pathName.substr(1).indexOf("/");
            let result = pathName.substr(0, index + 1);
            return result;
        }();

        let url = ctx + "/pages/student/studentLogin.html";
        //退出登录
        $("#logout").bind('click', function () {
            window.sessionStorage.clear();
            window.open(url, "_top", "", "true");
        })
        //个人信息
        $("#viewinfo").bind('click', function () {
            let vurl = ctx + "/pages/student/studentindex.html";
            window.open(vurl, "_top", "", "true");
        })
        //忘记密码
        $("#changepwd").bind('click', function () {
            let curl = ctx + "/pages/student/stuForget.html";
            window.open(curl, "_top", "", "true");
        })
        $("#icon-btn").bind('click', function () {
            let vurl = ctx + "/pages/student/studentindex.html";
            window.open(vurl, "_top", "", "true");
        })

        // 得到模版html
        var jobtpl = document.getElementById('demotpl').innerHTML;
        var entertpl = document.getElementById('demotpl1').innerHTML;
        //渲染推荐岗位
        okUtils.ajax("/ygssecs/getRecommendjoblist", "get", {postionnum: 12}, true).done(function (response) {
            //开始渲染
            laytpl(jobtpl).render(response.data, function (html) {
                document.getElementById('recommendjob').innerHTML = html;
            });
        }).fail(function (error) {
            console.log(error)
        });

        // 渲染最新岗位
        okUtils.ajax("/ygssecs/getjobList", "get", null, false).done(function (response) {
            //开始渲染
            laytpl(jobtpl).render(response.data, function (html) {
                document.getElementById('latestPosition').innerHTML = html;
            });
        }).fail(function (error) {
            console.log(error)
        });

        //渲染最新签约企业
        okUtils.ajax("/ygssecs/getEnterpriseTop12", "get", null, false).done(function (res) {
            laytpl(entertpl).render(res.data, function (html) {
                document.getElementById('latestEnterprise').innerHTML = html;
            });
        }).fail(function (error) {
            console.log(error)
        })

        //渲染明星企业
        okUtils.ajax("/ygssecs/getfamousEnterpriseList", "get", null, false).done(function (res) {
            laytpl(entertpl).render(res.data, function (html) {
                document.getElementById('famousEnterprise').innerHTML = html;
            });
        }).fail(function (error) {
            console.log(error)
        })

        //监听导航点击
        element.on('layui-nav', function (elem) {
            //console.log(elem)
            layer.msg(elem.text());
        });

        //绑定点击事件
        $("#searchbtn").click(function () {
            var qtype = $("[name='qt']").val();
            var keyword = $("[name='kw']").val();
            var url = ctx + "/pages/student/searchResult-stu.html?qt=" + qtype + "&kw=" + keyword;
            window.open(url, "_top", "", "true");
        })

        $("#seeMore").click(function () {
            var url = ctx + "/pages/student/searchResult-stu.html?qt=&kw=";
            window.open(url, "_top", "", "true");
        })
    });
</script>
</body>
</html>